package com.jt.controller;

import com.jt.feign.RemoteProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author SWJ
 * @create 2021-08-18 10:34
 * <p>
 * 创建FeignConsumerController中并添加feign访问
 */

@RestController
@RequestMapping("/consumer/ ")

public class FeignConsumerController {
    @Autowired
    private RemoteProviderService remoteProviderService;

    /**
     * 基于feign方式的服务调用
     */
    @GetMapping("/echo/{msg}")
    public String doFeignEcho(@PathVariable String msg) {
        //
        //基于feign方式进行远端服务调用(前提是服务必须存在)
        return remoteProviderService.echoMessage(msg);
    }
}
